<?php
require_once '../../global.inc.php';

//SESSION中取出分页信息
$totalRows      = $_SESSION["pageInfoMember"]["totalRows"];		//总记录数
$pageSize       = $_SESSION["pageInfoMember"]["pageSize"];		//每页记录数
$currentPage    = $_SESSION["pageInfoMember"]["currentPage"];		//当前页数
$totalPages     = $_SESSION["pageInfoMember"]["totalPages"];		//总页数
$startRow       = $_SESSION["pageInfoMember"]["startRow"];		//每页记录开始位置
$firstPage      = $_SESSION["pageInfoMember"]["firstPage"];		//首页
$prewPage       = $_SESSION["pageInfoMember"]["prewPage"];		//上一页
$nextPage       = $_SESSION["pageInfoMember"]["nextPage"];		//下一页
$lastPage       = $_SESSION["pageInfoMember"]["lastPage"];		//尾页
//SESSION中取出页面内数据信息
$memberArray	= $_SESSION["memberArray"];		//二维数组
$tag			= $_SESSION["tag"];				//查询后的展示方式（列表q，列表编辑e，加入活动j)

//释放不需要的SESSION资源
//unset($_SESSION["pageInfo"]);
//unset($_SESSION["userArray"]);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
<!--
body {
	margin-left: 3px;
	margin-top: 0px;
	margin-right: 3px;
	margin-bottom: 0px;
}
a {text-decoration:none}
a:hover {text-decoration:none}
img {border:0px;}
.STYLE1 {
	color: #e1e2e3;
	font-size: 12px;
}
.STYLE6 {color: #000000; font-size: 12; }
.STYLE10 {color: #000000; font-size: 12px; }
.STYLE19 {
	color: #344b50;
	font-size: 12px;
}
.STYLE21 {
	font-size: 12px;
	color: #3b6375;
}
.STYLE22 {
	font-size: 12px;
	color: #295568;
}
-->
</style>
<script type="text/javascript" src="../js/utils.js"></script>
<script type="text/javascript" src="js/member.js"></script>
</head>

<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="24" bgcolor="#353c44"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td  width="70%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="6%" height="19" valign="bottom"><div align="center"><img src="../images/tb.gif" width="14" height="14" /></div></td>
                <td width="94%" valign="bottom"><div align="left"><span class="STYLE1">会员基本信息列表</span></div></td>
              </tr>
            </table></td>
            <td>
            <?php if ($tag=="e"){?>
	            <div align="right"><span class="STYLE1">
	            	<a href='#' target='rightFrame' onclick="validAll()"><img src="../images/add.gif" width="10" height="10" /> <span class="STYLE1">批量恢复</span>    &nbsp;</a>
		            <a href='#' target='rightFrame' onclick="invalidAll()"><img src="../images/del.gif" width="10" height="10" /> <span class="STYLE1">批量失效</span>    &nbsp;</a>
	            </span><span class="STYLE1"> &nbsp;</span></div>
	        <?php }?>
            </td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#a8c7ce">
      <tr>
      <?php 
      if ($tag=="e"){
        echo "<td width='2%' height='20' bgcolor='d3eaef' class='STYLE10'><div align='center'><input type='checkbox' name='checkbox' id='checkbox' onclick=\"checkChg('checkbox','checkbox2')\"/></div></td>";
      }
      ?>
        <td width="10%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">会员卡号</span></div></td>
        <td width="10%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">会员姓名</span></div></td>
        <td width="10%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">会员网名</span></div></td>
        <td width="5%"  height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">会员性别</span></div></td>
        <td width="10%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">会员生日</span></div></td>
        <td width="15%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">证件号码</span></div></td>
        <td width="10%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">会员积分</span></div></td>
        <td width="10%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">QQ号码</span></div></td>
        <td width="5%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">会员状态</span></div></td>
      <?php 
      if ($tag=="e"){
        echo "<td width='8%' height='20' bgcolor='d3eaef' class='STYLE6'><div align='center'><span class='STYLE10'>基本操作</span></div></td>";
      }else if ($tag=="q"){
      	echo "<td width='8%' height='20' bgcolor='d3eaef' class='STYLE6'><div align='center'><span class='STYLE10'>详细信息</span></div></td>";
      }else if ($tag=="j"){
      	echo "<td width='8%' height='20' bgcolor='d3eaef' class='STYLE6'><div align='center'><span class='STYLE10'>加入活动</span></div></td>";
      }
      ?>
        
      </tr>
      <?php 
      foreach ($memberArray as $member) {
		$memberId		= $member["member_id"];			//会员序号
		$memberNo 		= $member["member_no"];			//会员卡号
		$memberName 	= $member["member_name"];		//会员姓名
		$netName 		= $member["net_name"];			//会员姓名
		$sex			= $member["sex"];				//性别
		$birthday		= $member["birthday"];			//生日
		$idNumber		= $member["id_number"];			//证件号码
		$score			= $member["score"];				//会员积分
		$qq				= $member["qq"];				//QQ号码
		$flag			= $member["flag"];				//会员状态
		
		if($sex==1)  $sexName="男";   else $sexName="女";
		if($flag==1) $flagName="有效"; else $flagName="失效";
		echo "<tr>";
		if ($tag=="e"){
			echo "<td height='20' bgcolor='#FFFFFF'><div align='center'><input type='checkbox' name='checkbox2' id='$memberId' value='$memberId' /></div></td>";
	    }
			echo "<td height='20' bgcolor='#FFFFFF' class='STYLE6'><div align='center'><span class='STYLE19'>$memberNo</span></div></td>";            
	        echo "<td height='20' bgcolor='#FFFFFF' class='STYLE19'><div align='center'>$memberName</div></td>";
	        echo "<td height='20' bgcolor='#FFFFFF' class='STYLE19'><div align='center'>$netName</div></td>";
	        echo "<td height='20' bgcolor='#FFFFFF' class='STYLE19'><div align='center'>$sexName</div></td>";
	        echo "<td height='20' bgcolor='#FFFFFF' class='STYLE19'><div align='center'>$birthday</div></td>";
	        echo "<td height='20' bgcolor='#FFFFFF' class='STYLE19'><div align='center'>$idNumber</div></td>";                                 
	        echo "<td height='20' bgcolor='#FFFFFF' class='STYLE19'><div align='center'>$score</div></td>";   
	        echo "<td height='20' bgcolor='#FFFFFF' class='STYLE19'><div align='center'>$qq</div></td>";
	        echo "<td height='20' bgcolor='#FFFFFF' class='STYLE19'><div align='center'>$flagName</div></td>";  
	    if ($tag=="e"){
			echo "<td height='20' bgcolor='#FFFFFF'><div align='center' class='STYLE21'>";
			if($flag==1){
	        	echo "<a href='#'><img src='../images/del.gif' width='10' height='10' title='失效' onclick='invalidOne($memberId)'/> </a>&nbsp;|&nbsp;";//用户有效就显示失效按钮
	        }else{
				echo "<a href='#'><img src='../images/add.gif' width='10' height='10' title='恢复' onclick='validOne($memberId)'/> </a>&nbsp;|&nbsp;";//用户无效就显示恢复按钮
			}
	        echo "<a href='../../action/memberAction.php?op=get&tag=e&id=$memberId' target='rightFrame'><img src='../images/edit.gif' width='10' height='10' title='编辑'/></a>";
	        echo "</div></td>";
	    }else if ($tag=="q"){
			echo "<td height='20' bgcolor='#FFFFFF'><div align='center' class='STYLE21'>";
			echo "<a href='../../action/memberAction.php?op=get&tag=q&id=$memberId' target='rightFrame'><img src='../images/add.gif' width='10' height='10' title='详细信息'/> </a>";//显示会员详细信息
			echo "</div></td>";
		}else if ($tag=="j"){
			echo "<td height='20' bgcolor='#FFFFFF'><div align='center' class='STYLE21'>";
			echo "<a href='../../action/instanceMemberAction.php?op=join&id=$memberId' target='_self'><img src='../images/add.gif' width='10' height='10' title='加入活动'/> </a>";//会员加入活动
			echo "</div></td>";
		}
		echo "</tr>";
      }
	 ?>
    </table></td>
  </tr>
  <tr>
    <td height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="33%"><div align="left">
        	<span class="STYLE22">&nbsp;&nbsp;&nbsp;&nbsp;
	        	共有<strong><?php echo $totalRows ?></strong> 条记录，
	        	当前第<strong><?php echo $currentPage ?></strong> 页，
	        	共 <strong><?php echo $totalPages ?></strong> 页
        	</span>
        </div></td>
        <td width="67%"><table width="312" border="0" align="right" cellpadding="0" cellspacing="0">
          <tr>
            <td width="49"><div align="center"><a href='../../action/memberAction.php?op=query&p=<?php echo $firstPage?>'><img src="../images/main_54.gif" width="40" height="15" /></a></div></td>
            <td width="49"><div align="center"><a href='../../action/memberAction.php?op=query&p=<?php echo $prewPage?>' ><img src="../images/main_56.gif" width="45" height="15" /></a></div></td>
            <td width="49"><div align="center"><a href='../../action/memberAction.php?op=query&p=<?php echo $nextPage?>' ><img src="../images/main_58.gif" width="45" height="15" /></a></div></td>
            <td width="49"><div align="center"><a href='../../action/memberAction.php?op=query&p=<?php echo $lastPage?>' ><img src="../images/main_60.gif" width="40" height="15" /></a></div></td>
            <td width="37" class="STYLE22"><div align="center">转到</div></td>
            <td width="22"><div align="center">
              <input type="text" name="textfield" id="textfield"  style="width:20px; height:12px; font-size:12px; border:solid 1px #7aaebd;"/>
            </div></td>
            <td width="22" class="STYLE22"><div align="center">页</div></td>
            <td width="35"><img src="../images/main_62.gif" width="26" height="15"  onclick="jumpToPage()"/></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>
